<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>
    <?php echo $titlename ?>
    </title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
</head>
<body>


<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
  <ul class="navbar-nav">
  <li class="nav-item ">
  <a class="nav-link" href ="index.php?c=Users&a=home"><?php echo $this->username; ?>的任务</a>
    </li>
    <li class="nav-item active">
      <a  class="nav-link" href ="index.php?c=Tasks&a=all">所有任务</a>
    </li>
    <li class="nav-item">
    <a class="nav-link" href ="index.php?c=Tasks&a=progress">项目进度</a>
    </li>
    <li class="nav-item">
    <a  class="nav-link" href ="index.php?c=Tasks&a=input">发布任务</a>
    </li>
    <li class="nav-item">
    <a class="nav-link" href ="index.php?c=Users&a=logOut">注销</a>
    </li>
  </ul>
</nav>  

<div class="container" style="margin-top: 30px">
<h2> 
所有任务
</h2>
<table class="table">
<tr>
  <th>任务标题</th>
  <th>负责人</th>
  <th>发布人</th>
  <th>完成状态</th>
  <th>查看详情</th>
</tr>
<?php
foreach ($result as $value) {
  ?>
      <tr class="<?php 
      if ($value[3] !== '0') {
        echo("table-secondary");
      }else if ($value[1] === $this->username) {
        echo("table-danger");
      }else{
        echo("table-success");
      }
      
      ?>"
      
      >
      <td style="padding-top:15px"><?php echo $value[0]; ?></td>

      <td style="padding-top:15px"><?php 
          if ($value[1] === null) {
            echo ("无人负责");
          } else {
            echo $value[1];
          }
          ?></td>

      <td style="padding-top:15px"><?php echo $value[2]; ?></td>

      <td style="padding-top:15px"><?php 
          if ($value[3] === '0') {
            echo ("尚未完成");
          } else {
            echo ("已完成");
          }
          ?></td>
      
      <td><form  style="margin-bottom:0px" action= "index.php?c=Tasks&a=detail&id=<?php echo $value[4]; ?>" method="post"><button type="submit" class="btn btn-primary btn-sm" >查看详情</button></form></td>
      </tr>
    <?php

  }
  ?>
</table>
<br>
</div>
</body>
</html>

